package com.neutech.maplestory.util;

import com.neutech.maplestory.constant.Constant;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;

public  class GameUtil {
    private GameUtil(){}

    /**
     * 通过路径来读取图片，这个是为了在map中找到值也就是路径的
     * @param imageName
     * @return
     */
    public static Image getImage(String imageName){
        URL url = GameUtil.class.getClassLoader().getResource(Constant.GAME_PATH_PRE + imageName + Constant.GAME_PATH_LAX);
        BufferedImage image = null;
        try {
            image = ImageIO.read(url);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return image;
    }

}
